package com.exposit.zbs.utils;

import com.exposit.zbs.service.IGrantApplicationService;
import org.apache.tiles.AttributeContext;
import org.apache.tiles.preparer.ViewPreparer;
import org.apache.tiles.request.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class MenuPreparer implements ViewPreparer {

	@Autowired
	IGrantApplicationService service;

	@Override
	public void execute(Request tilesContext, AttributeContext attributeContext) {

		tilesContext.getContext("request").put("grantAreasMenu", service.getAllAreas());
		tilesContext.getContext("request").put("grantApplicationsRequested", service.getCountOfRequstedGrantApplications());
	}

}
